package com.surge;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SurgeMain {

	private static ApplicationContext ctx;

	public static void main(String[] args) {
		
		
		// 创建 Spring 的 IOC 容器
		ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		
		/*
		 * 1、list集合映射
		 */
		Person person2 =  (Person) ctx.getBean("person2");
		
		System.out.println(person2);
		
		/*
		 * 2、map集合映射
		 */
		PersonMap person3 =  (PersonMap) ctx.getBean("person3");
		
		System.out.println(person3);
		
		/*
		 * 3、properties 集合映射
		 */
		DataSource dataSource =  (DataSource) ctx.getBean("dataSource");
		
		System.out.println(dataSource);
		
		/*
		 * 4、配置独立的 list集合映射
		 */
		Person person4 =  (Person) ctx.getBean("person4");
		
		System.out.println(person4);
		
		/*
		 * 5、 通过 P 命名空间 为bean 属性赋值 
		 */
		Person person5 =  (Person) ctx.getBean("person5");
		
		System.out.println(person5);
		
		
		
		
		
	}

}
